package com.ruoyi.safe.service.impl;

import java.util.*;

import cn.hutool.core.util.IdUtil;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.safe.service.IListTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.safe.mapper.ListConstructionMapper;
import com.ruoyi.safe.domain.ListConstruction;
import com.ruoyi.safe.service.IListConstructionService;

/**
 * 施工清单Service业务层处理
 * 
 * @author buxi
 * @date 2023-11-04
 */
@Service
public class ListConstructionServiceImpl implements IListConstructionService 
{
    @Autowired
    private ListConstructionMapper listConstructionMapper;
    @Autowired
    private IListTypeService listTypeService;

    /**
     * 查询施工清单
     * 
     * @param id 施工清单主键
     * @return 施工清单
     */
    @Override
    public ListConstruction selectListConstructionById(Long id)
    {
        return listConstructionMapper.selectListConstructionById(id);
    }

    /**
     * 查询施工清单列表
     * 
     * @param listConstruction 施工清单
     * @return 施工清单
     */
    @Override
    public List<ListConstruction> selectListConstructionList(ListConstruction listConstruction)
    {
        return listTypeService.processList(listConstructionMapper.selectListConstructionList(listConstruction));
    }

    /**
     * 查询施工清单列表
     *
     * @param listConstruction 施工清单
     * @return 施工清单
     */
    @Override
    public List<ListConstruction> selectListConstructionListAll(ListConstruction listConstruction)
    {
        return listConstructionMapper.selectListConstructionListAll(listConstruction);
    }

    /**
     * 新增施工清单
     * 
     * @param listConstruction 施工清单
     * @return 结果
     */
    @Override
    public int insertListConstruction(ListConstruction listConstruction)
    {
        listConstruction.setCreateTime(DateUtils.getNowDate());
        listConstruction.setCreateBy(SecurityUtils.getUsername());
        listConstruction.setId(IdUtil.getSnowflakeNextId());
        return listConstructionMapper.insertListConstruction(listConstruction);
    }

    /**
     * 修改施工清单
     * 
     * @param listConstruction 施工清单
     * @return 结果
     */
    @Override
    public int updateListConstruction(ListConstruction listConstruction)
    {
        listConstruction.setUpdateTime(DateUtils.getNowDate());
        listConstruction.setUpdateBy(SecurityUtils.getUsername());
        return listConstructionMapper.updateListConstruction(listConstruction);
    }

    /**
     * 批量删除施工清单
     * 
     * @param ids 需要删除的施工清单主键
     * @return 结果
     */
    @Override
    public int deleteListConstructionByIds(Long[] ids)
    {
        return listConstructionMapper.deleteListConstructionByIds(ids);
    }

    /**
     * 删除施工清单信息
     * 
     * @param id 施工清单主键
     * @return 结果
     */
    @Override
    public int deleteListConstructionById(Long id)
    {
        return listConstructionMapper.deleteListConstructionById(id);
    }
}
